package com.zyj.java;

/**
 * @program: JVMDemo
 * @ClassName LocalVarGC
 * @author: YaJun
 * @Date: 2022 - 01 - 24 - 10:51
 * @Package: com.zyj.java
 * @Description:
 */
public class LocalVarGC {

    public void LocalVarGC1() {
        byte[] buffer = new byte[10 * 1024 * 1024]; // 10M
        System.gc();
    }

    public void LocalVarGC2() {
        byte[] buffer = new byte[10 * 1024 * 1024];
        buffer = null;
        System.gc();
    }

    public void LocalVarGC3() {
        {
            byte[] buffer = new byte[10 * 1024 * 1024];
        }
        System.gc();
    }

    public void LocalVarGC4() {
        {
            byte[] buffer = new byte[10 * 1024 * 1024];
        }
        int value = 10;
        System.gc();
    }

    public void LocalVarGC5() {
        LocalVarGC1();
        System.gc();
    }

    public static void main(String[] args) {
        LocalVarGC local = new LocalVarGC();
        local.LocalVarGC5();
    }

}
